using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Blople.GameComponents;


namespace Blople.GameScenes
{
    public class MenuScene : GameScene
    {
        protected Texture2D backgroundTexture;

        protected Logo logo;
        protected TextMenu menu;

        protected Song outgameSong;

        public MenuScene(Game game, Texture2D backgroundTexture, Texture2D menuTexture, Texture2D logoTexture, Song outgameSong, SpriteFont font) : base(game)
        {
            logo = new Logo(game, logoTexture);
            components.Add(logo);
            menu = new TextMenu(game, font, menuTexture);
            menu.AddMenuItem("Start");
            menu.AddMenuItem("Help");
            menu.AddMenuItem("Highscore");
            menu.AddMenuItem("Credits");
            menu.AddMenuItem("Quit");
            components.Add(menu);
            this.backgroundTexture = backgroundTexture;
            this.outgameSong = outgameSong;
        }

        public override void Initialize()
        {
            base.Initialize();
        }

        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
        }

        public override void Draw(GameTime gameTime)
        {
            SpriteBatch sBatch = (SpriteBatch)Game.Services.GetService(typeof(SpriteBatch));
            sBatch.Draw(backgroundTexture, new Vector2(0, 0), Color.White);
            base.Draw(gameTime);
        }

        public int SelectedMenuIndex
        {
            get { return menu.SelectedIndex; }
        }

        public override void Show()
        {
            MediaPlayer.Play(outgameSong);
            base.Show();
        }
    }
}
